import request from "@/utils/request"
import {
    LoginParams,
    LoginRes,
    SendCodeRes,
    MemberCountRes,
    QueryMineRes,
    QueryParams,
    QueryRes, DeleteByIdRes
} from "@/api/member/type";

/**
 * 登录
 * @param params
 */
export function login(params: LoginParams): Promise<LoginRes> {
    return request.post(`/member/member/login`, params);
}

export function sendCode(mobile: string): Promise<SendCodeRes> {
    return request.get(`/member/member/sendCode?mobile=${mobile}`);
}

/**
 * 会员总数
 * @returns
 */
export function memberCount(): Promise<MemberCountRes> {
    return request.get(`/member/member/count`);
}

/**
 * 查询我的乘客信息
 * @returns
 */
export function queryMine(): Promise<QueryMineRes> {
    return request.get(`/member/passenger/query-mine`);
}

/**
 * query
 * @param {object} params TicketQueryReq
 * @param {number} params.pageNum
 * @param {number} params.pageSize
 * @returns
 */
export function query(params: QueryParams): Promise<QueryRes> {
    return request.post(`/member/ticket/query-list`, params);
}

/**
 * deleteById
 * @param {string} id
 * @returns
 */
export function deleteById(id: number): Promise<DeleteByIdRes> {
    return request.delete(`/member/admin/ticket/delete/${id}`);
}